<!-- include tpl=head title="发票设置 - 个人中心" -->
<script type="text/javascript">
function invoice_default(id)
{
	var url = api_url('usercp','invoice_default','id='+id);
	$.phpok.json(url,function(data){
		if(data.status != 'ok'){
			$.dialog.alert(data.content);
		}else{
			$.phpok.reload();
		}
	});
}
function invoice_delete(id)
{
	$.dialog.confirm('确定要删除这个发票信息吗？',function(){
		var url = api_url('usercp','invoice_delete','id='+id);
		$.phpok.json(url,function(){
			$.phpok.reload();
		})
	})
}
function invoice_setting(id)
{
	var url = get_url('usercp','invoice_setting');
	if(id>0){
		url += "&id="+id;
	}
	$.phpok.go(url);
}
</script>
<div role="main" class="ui-content">
	<!-- if $total<10 && $rslist && count($rslist)>3 -->
	<a href="javascript:invoice_setting(0);void(0)" class="ui-btn ui-btn-a">+ 添加发票</a>
	<!-- /if -->
	<ul data-role="listview" data-inset="true">
		<!-- loop from=$rslist key=$key value=$value id=$tmpid -->
		<li data-role="list-divider">
			#{$value.id} {$value.type}
			<!-- if !$value.is_default -->
			<span class="ui-li-count hand" onclick="invoice_default('{$value.id}')">设为默认</span>
			<!-- else -->
			<span class="ui-li-count red">默认地址</span>
			<!-- /if -->
		</li>
		<li>
			<div class="wrap"><b>发票抬头：</b>{$value.title}</div>
			<!-- if $value.content -->
			<div><b>发票内容：</b>{$value.content}</div>
			<!-- /if -->
			<!-- if $value.note -->
			<div><b>备注：</b>{func nl2br $value.note}</div>
			<!-- /if -->
			<span class="ui-li-count" style="top:75%;right:0.3em;">
				<a href="javascript:invoice_setting('{$value.id}');void(0);">编辑</a> | <a href="javascript:invoice_delete('{$value.id}');void(0);">删除</a>
			</span>
		</li>
		<!-- /loop -->
	</ul>
	<!-- if $total<10 -->
	<a href="javascript:invoice_setting(0);void(0)" class="ui-btn ui-btn-a">+ 添加发票</a>
	<!-- /if -->
</div>

<!-- include tpl=foot -->